from typing import Optional
from pydantic import BaseModel, ConfigDict
from datetime import datetime
from uuid import UUID


class EventBase(BaseModel):
    activity_id: UUID
    name: str
    occurred_at: datetime
    location_admin: Optional[str] = None
    location_detail: Optional[str] = None
    latitude: Optional[float] = None
    longitude: Optional[float] = None
    event_type_id: Optional[UUID] = None
    description: Optional[str] = None
    status: Optional[str] = 'new'


class EventCreate(EventBase):
    pass


class EventUpdate(EventBase):
    pass


class EventRead(EventBase):
    id: UUID

    model_config = ConfigDict(from_attributes=True, json_encoders={
        UUID: str
    })
